package space

import (
	"time"

	"gitee.com/night-tc/gobige/entity"
)

// 场景接口
type ISpace interface {
	entity.IEntity
	entity.IEntities

	//回收进Pool
	GCPool()
}

// 回收进Pool;进去后state进入到暂停状态
func (this *Space) GCPool() {
	this.Timer.Stop()
	this.Timer.DeleteAllTimerTask()
	this.PathFindermgr.RemoveAllObstacle()
	this.PathFindermgr.UpdateObstacle()
	this.SetEntityState(entity.Entity_State_Suspend)
}

// 恢复到Loop状态;一般是从Pool拿出来的时候，会跑的逻辑
func (this *Space) ReLoop() {
	this.StartTime = time.Now()
	this.SetNowTime(this.StartTime)
	this.Timer.ReStart(this.StartTime.UnixMilli())
	this.SetEntityState(entity.Entity_State_Loop)
}
